<template>
  <div class="header">
    <h2>odin7c-j开发框架</h2>
    <span class="username">你好! {{username}}<span @click="layout"><Icon type="power" size="16"></Icon></span></span>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
      cityname:'',
    };
  },
  created() {
    this.username = localStorage.getItem("username");
  },
  activated(){
    this.username = localStorage.getItem("username");
  },
  deactivated(){

  },
  mounted() {
    this.cityname = localStorage.getItem("cityname");
  },
  methods: {
    layout() {
      localStorage.clear();                              //清除所有localStorage
      //localStorage.setItem('accounts',this.accounts)     
      //刷新当前界面
      this.$router.push('/login');
    },
  }
};
</script>
<style lang="scss" scoped>
.header{
  background: url(../../../static/img/map.png) center center no-repeat;
  background-size: cover;
  padding: 0 20px 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px !important;
  color: #fff;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
}
h2{
  color: #fff;
  font-size: 24px;
}
.header .username {
  font-size:14px;
  span{
    padding-left: 10px;
    cursor: pointer;
  }
}
</style>
